<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>{$head[title]}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta content="{$head[keywords]}" name="keywords" />
<meta content="{$head[description]}" name="description" />
<base href="{SITE_URL}" />
<link href="favicon.ico" rel="shortcut icon" />
<link href="skin/style.css" rel="stylesheet" type="text/css" />
<link rel="alternate" type="application/rss+xml" title="{$head[title]}" href="/rss.php?rssid={$catid}" />
<script language="JavaScript" src="misc/config.js"></script>
<script language="JavaScript" src="misc/jquery.min.js"></script>
<script language="JavaScript" src="misc/common.js"></script>
<script language="JavaScript" src="misc/validator.js"></script>
</head>
<body>

{template 'header.html'}

<div class="container">
	
    <div class="aside">
    	 {template 'left.html','pay'}
    </div>
    <div class="main"> 
    
        <p id="position"><strong>当前位置：</strong><a href="{$M[url]}">财务管理</a>购买点数</p>
        <!--欢迎页基本信息-->
        <div class="clear"></div>
        <div class="clear"></div>
        <!--列表样式-->
        
        <div class="head">购买点数</div>
        <form name="thisForm" id= "thisForm" action="{$MODULE[$mod]['url']}showpayment.php?action=buypoint" method="POST" onSubmit="return check();">
        <table cellpadding="0" cellspacing="1" class="table"> 
        <tr>
            <th width="15%">点数余额：</th>        
            <td>{$_point} 点</td>
         </tr>
         <tr>
            <th width="15%">资金余额：</th>        
            <td>{$_amount} 元 <span id="amount" name="amount"></span></td>
         </tr>      
          <tr>
            <th width="25%">充值：</th>
            <td>
            {loop $infos $info}
              <input type="radio" value='{$info[ptypeid]}' checked onClick="check_amount()" id = "pid" name="pid"/>&nbsp;{$info['point']}点（{$info['amount']}元）<br />
            {/loop}
            </td>
          </tr>       
          <tr>
            <th></th>
            <td colspan="2"><label>
              <input type="submit" name="button" id="button" value="确认购买" />
              </label></td>
          </tr>
        </table>
        </form>
        <div class="button_box">
        </div>
        <div id="pagination">{$pages}</div>
    </div>
 </div>



<script type="text/javascript">
<!--
var amount = {$_amount};
var cardtype = Array();
{loop $infos $info}
cardtype[{$info[ptypeid]}] = {$info['amount']};
{/loop}
function check()
{
    check_amount();
     var id = $("input[name=pid]:checked").val();
    var total = cardtype[id];
    if(total > {$_amount})
    {
        alert('资金不足，请充值！');
        return false;
    }
    return true;
}
function check_amount()
{
    var id = $("input[name=pid]:checked").val();
    var total = cardtype[id];
    if(total > {$_amount})
    {
         var url = 'showpayment.php?action=type&pay=online';
         $('#amount').html('您的资金不足，请<a href="pay/'+url+'" style="color:red;">点击这里充值</a>！');
         return false;
    }
    else 
    {
        $('#amount').html('');
        return true;
    }
}
//-->
</script>
{template 'footer.html'}
